package org.example

import org.apache.spark.{SparkConf, SparkContext}

object MainObj {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("WordCount").setMaster("local[*]")
    val sc = new SparkContext(conf)
    val words = List("hello spark", "hello scala", "hello java")
    sc.parallelize(words).flatMap(_.split(" ")).filter(_ != "java").map((_, 1)).reduceByKey(_ + _).collect().foreach(println)
    sc.stop()
  }
}
